from mitmproxy import http
from fake_useragent import UserAgent

ua = UserAgent().random


def request(flow: http.HTTPFlow) -> None:
    if flow.request.pretty_url == 'http://a.hl.mi.com/m':
        flow.request.headers['User-Agent'] = ua



def response(flow: http.HTTPFlow) -> None:
    if flow.request.pretty_url == 'http://a.hl.mi.com/m':
        print(flow.response.json())
